\(\int x^2 \cot ^2(a+i \log (x)) \, dx\) [195]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 64 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=-6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}-x^2}+6 e^{3 i a} \text {arctanh}\left (e^{-i a} x\right ) \]

[Out]

-6*exp(2*I*a)*x-1/3*x^3-2*exp(2*I*a)*x^3/(exp(2*I*a)-x^2)+6*exp(3*I*a)*arctanh(x/exp(I*a))

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4592, 456, 474, 470, 327, 213} \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=6 e^{3 i a} \text {arctanh}\left (e^{-i a} x\right )-\frac {2 e^{2 i a} x^3}{-x^2+e^{2 i a}}-6 e^{2 i a} x-\frac {x^3}{3} \]

[In]

Int[x^2*Cot[a + I*Log[x]]^2,x]

[Out]

-6*E^((2*I)*a)*x - x^3/3 - (2*E^((2*I)*a)*x^3)/(E^((2*I)*a) - x^2) + 6*E^((3*I)*a)*ArcTanh[x/E^(I*a)]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 470

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(b*e*(m + n*(p + 1) + 1))), x] - Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(b*(m +
 n*(p + 1) + 1)), Int[(e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x] && NeQ[b*c - a*d, 0]
 && NeQ[m + n*(p + 1) + 1, 0]

Rule 474

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^2, x_Symbol] :> Simp[(-(b*c - a*
d)^2)*(e*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*b^2*e*n*(p + 1))), x] + Dist[1/(a*b^2*n*(p + 1)), Int[(e*x)^m*(a +
 b*x^n)^(p + 1)*Simp[(b*c - a*d)^2*(m + 1) + b^2*c^2*n*(p + 1) + a*b*d^2*n*(p + 1)*x^n, x], x], x] /; FreeQ[{a
, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p, -1]

Rule 4592

Int[Cot[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*((-I - I*E^(2*I*a*d)
*x^(2*I*b*d))/(1 - E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\left (-i-\frac {i e^{2 i a}}{x^2}\right )^2 x^2}{\left (1-\frac {e^{2 i a}}{x^2}\right )^2} \, dx \\ & = \int \frac {x^2 \left (-i e^{2 i a}-i x^2\right )^2}{\left (-e^{2 i a}+x^2\right )^2} \, dx \\ & = -\frac {2 e^{2 i a} x^3}{e^{2 i a}-x^2}+\frac {1}{2} e^{-2 i a} \int \frac {x^2 \left (-10 e^{4 i a}-2 e^{2 i a} x^2\right )}{-e^{2 i a}+x^2} \, dx \\ & = -\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}-x^2}-\left (6 e^{2 i a}\right ) \int \frac {x^2}{-e^{2 i a}+x^2} \, dx \\ & = -6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}-x^2}-\left (6 e^{4 i a}\right ) \int \frac {1}{-e^{2 i a}+x^2} \, dx \\ & = -6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}-x^2}+6 e^{3 i a} \text {arctanh}\left (e^{-i a} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.56 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=-\frac {x^3}{3}-4 x \cos (2 a)+6 \text {arctanh}(x (\cos (a)-i \sin (a))) \cos (3 a)-4 i x \sin (2 a)+\frac {2 x (\cos (3 a)+i \sin (3 a))}{\left (-1+x^2\right ) \cos (a)-i \left (1+x^2\right ) \sin (a)}+6 i \text {arctanh}(x (\cos (a)-i \sin (a))) \sin (3 a) \]

[In]

Integrate[x^2*Cot[a + I*Log[x]]^2,x]

[Out]

-1/3*x^3 - 4*x*Cos[2*a] + 6*ArcTanh[x*(Cos[a] - I*Sin[a])]*Cos[3*a] - (4*I)*x*Sin[2*a] + (2*x*(Cos[3*a] + I*Si
n[3*a]))/((-1 + x^2)*Cos[a] - I*(1 + x^2)*Sin[a]) + (6*I)*ArcTanh[x*(Cos[a] - I*Sin[a])]*Sin[3*a]

Maple [A] (verified)

Time = 1.07 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.75

method result size
risch \(-\frac {7 x^{3}}{3}-\frac {2 x^{3}}{\frac {{\mathrm e}^{2 i a}}{x^{2}}-1}-6 \,{\mathrm e}^{2 i a} x +6 \,\operatorname {arctanh}\left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{3 i a}\) \(48\)

[In]

int(x^2*cot(a+I*ln(x))^2,x,method=_RETURNVERBOSE)

[Out]

-7/3*x^3-2*x^3/(exp(2*I*a)/x^2-1)-6*exp(2*I*a)*x+6*arctanh(x*exp(-I*a))*exp(3*I*a)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 102 vs. \(2 (47) = 94\).

Time = 0.24 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.59 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=-\frac {x^{5} + 11 \, x^{3} e^{\left (2 i \, a\right )} - 9 \, {\left (x^{2} - e^{\left (2 i \, a\right )}\right )} e^{\left (3 i \, a\right )} \log \left ({\left (x e^{\left (2 i \, a\right )} + e^{\left (3 i \, a\right )}\right )} e^{\left (-2 i \, a\right )}\right ) + 9 \, {\left (x^{2} - e^{\left (2 i \, a\right )}\right )} e^{\left (3 i \, a\right )} \log \left ({\left (x e^{\left (2 i \, a\right )} - e^{\left (3 i \, a\right )}\right )} e^{\left (-2 i \, a\right )}\right ) - 18 \, x e^{\left (4 i \, a\right )}}{3 \, {\left (x^{2} - e^{\left (2 i \, a\right )}\right )}} \]

[In]

integrate(x^2*cot(a+I*log(x))^2,x, algorithm="fricas")

[Out]

-1/3*(x^5 + 11*x^3*e^(2*I*a) - 9*(x^2 - e^(2*I*a))*e^(3*I*a)*log((x*e^(2*I*a) + e^(3*I*a))*e^(-2*I*a)) + 9*(x^
2 - e^(2*I*a))*e^(3*I*a)*log((x*e^(2*I*a) - e^(3*I*a))*e^(-2*I*a)) - 18*x*e^(4*I*a))/(x^2 - e^(2*I*a))

Sympy [A] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 60, normalized size of antiderivative = 0.94 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=- \frac {x^{3}}{3} - 4 x e^{2 i a} + \frac {2 x e^{4 i a}}{x^{2} - e^{2 i a}} - 3 \left (\log {\left (x - e^{i a} \right )} - \log {\left (x + e^{i a} \right )}\right ) e^{3 i a} \]

[In]

integrate(x**2*cot(a+I*ln(x))**2,x)

[Out]

-x**3/3 - 4*x*exp(2*I*a) + 2*x*exp(4*I*a)/(x**2 - exp(2*I*a)) - 3*(log(x - exp(I*a)) - log(x + exp(I*a)))*exp(
3*I*a)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 335 vs. \(2 (47) = 94\).

Time = 0.22 (sec) , antiderivative size = 335, normalized size of antiderivative = 5.23 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=-\frac {2 \, x^{5} + 22 \, x^{3} {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} + 18 \, {\left ({\left (-i \, \cos \left (3 \, a\right ) + \sin \left (3 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x + \cos \left (a\right )\right ) + {\left (-i \, \cos \left (3 \, a\right ) + \sin \left (3 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x - \cos \left (a\right )\right )\right )} x^{2} - 36 \, x {\left (\cos \left (4 \, a\right ) + i \, \sin \left (4 \, a\right )\right )} + 18 \, {\left ({\left (i \, \cos \left (2 \, a\right ) - \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) - {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x + \cos \left (a\right )\right ) + 18 \, {\left ({\left (i \, \cos \left (2 \, a\right ) - \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) - {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x - \cos \left (a\right )\right ) - 9 \, {\left (x^{2} {\left (\cos \left (3 \, a\right ) + i \, \sin \left (3 \, a\right )\right )} - {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) - {\left (i \, \cos \left (2 \, a\right ) - \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \log \left (x^{2} + 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) + 9 \, {\left (x^{2} {\left (\cos \left (3 \, a\right ) + i \, \sin \left (3 \, a\right )\right )} - {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) + {\left (-i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \log \left (x^{2} - 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right )}{6 \, {\left (x^{2} - \cos \left (2 \, a\right ) - i \, \sin \left (2 \, a\right )\right )}} \]

[In]

integrate(x^2*cot(a+I*log(x))^2,x, algorithm="maxima")

[Out]

-1/6*(2*x^5 + 22*x^3*(cos(2*a) + I*sin(2*a)) + 18*((-I*cos(3*a) + sin(3*a))*arctan2(sin(a), x + cos(a)) + (-I*
cos(3*a) + sin(3*a))*arctan2(sin(a), x - cos(a)))*x^2 - 36*x*(cos(4*a) + I*sin(4*a)) + 18*((I*cos(2*a) - sin(2
*a))*cos(3*a) - (cos(2*a) + I*sin(2*a))*sin(3*a))*arctan2(sin(a), x + cos(a)) + 18*((I*cos(2*a) - sin(2*a))*co
s(3*a) - (cos(2*a) + I*sin(2*a))*sin(3*a))*arctan2(sin(a), x - cos(a)) - 9*(x^2*(cos(3*a) + I*sin(3*a)) - (cos
(2*a) + I*sin(2*a))*cos(3*a) - (I*cos(2*a) - sin(2*a))*sin(3*a))*log(x^2 + 2*x*cos(a) + cos(a)^2 + sin(a)^2) +
 9*(x^2*(cos(3*a) + I*sin(3*a)) - (cos(2*a) + I*sin(2*a))*cos(3*a) + (-I*cos(2*a) + sin(2*a))*sin(3*a))*log(x^
2 - 2*x*cos(a) + cos(a)^2 + sin(a)^2))/(x^2 - cos(2*a) - I*sin(2*a))

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.30 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=-\frac {x^{5}}{3 \, {\left (x^{2} - e^{\left (2 i \, a\right )}\right )}} - \frac {11 \, x^{3} e^{\left (2 i \, a\right )}}{3 \, {\left (x^{2} - e^{\left (2 i \, a\right )}\right )}} - \frac {6 \, \arctan \left (\frac {x}{\sqrt {-e^{\left (2 i \, a\right )}}}\right ) e^{\left (4 i \, a\right )}}{\sqrt {-e^{\left (2 i \, a\right )}}} + \frac {10 \, x e^{\left (4 i \, a\right )}}{x^{2} - e^{\left (2 i \, a\right )}} \]

[In]

integrate(x^2*cot(a+I*log(x))^2,x, algorithm="giac")

[Out]

-1/3*x^5/(x^2 - e^(2*I*a)) - 11/3*x^3*e^(2*I*a)/(x^2 - e^(2*I*a)) - 6*arctan(x/sqrt(-e^(2*I*a)))*e^(4*I*a)/sqr
t(-e^(2*I*a)) + 10*x*e^(4*I*a)/(x^2 - e^(2*I*a))

Mupad [B] (verification not implemented)

Time = 27.40 (sec) , antiderivative size = 57, normalized size of antiderivative = 0.89 \[ \int x^2 \cot ^2(a+i \log (x)) \, dx=-{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\right )}^{3/2}\,\mathrm {atan}\left (\frac {x\,1{}\mathrm {i}}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )\,6{}\mathrm {i}-\frac {x^3}{3}-4\,x\,{\mathrm {e}}^{a\,2{}\mathrm {i}}-\frac {2\,x\,{\mathrm {e}}^{a\,4{}\mathrm {i}}}{{\mathrm {e}}^{a\,2{}\mathrm {i}}-x^2} \]

[In]

int(x^2*cot(a + log(x)*1i)^2,x)

[Out]

- exp(a*2i)^(3/2)*atan((x*1i)/exp(a*2i)^(1/2))*6i - x^3/3 - 4*x*exp(a*2i) - (2*x*exp(a*4i))/(exp(a*2i) - x^2)